package org.jxf.gps.jt808.message;

import org.jfk.core.utils.ByteUtils;
import org.jxf.gps.jfinal.model.GPSTerminal;
import org.jxf.gps.jfinal.model.Trace;


/**
 * 终端注册处理
 * @author jxf
 * 2015年10月21日
 */
public class MsgBodyHandle0100 extends MsgBodyHandle {

	@Override
	public Message genResp() {
		
		Message msg = new Message();
		msg.msgId = 0x8001;
		msg.pkg = false;

		msg.cipher = 0;
		msg.mdn = moMsg.mdn;

		msg.sn = ByteUtils.byte2ToInt(ByteUtils.longToWord(System.currentTimeMillis()));

		byte[] sn = ByteUtils.intToWord(moMsg.sn);
		byte[] result = { 0x00 };
		msg.body = ByteUtils.byteMerger(sn, result);
		//返回鉴权码
		msg.msgId = 0x8100;
		msg.body = ByteUtils.byteMerger(msg.body, "1234567890A".getBytes());
		return msg;
	}

	
}
